package com.pactera.madp.cp.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pactera.madp.common.core.util.R;
import com.pactera.madp.cp.api.dto.workroom.WorkContactRoomIndexDto;
import com.pactera.madp.cp.api.dto.workroom.WorkRoomIndexDto;
import com.pactera.madp.cp.api.dto.workroom.WorkRoomStatisticsIndexDto;
import com.pactera.madp.cp.api.em.permission.ReqPerEnum;
import com.pactera.madp.cp.api.entity.WorkRoomEntity;
import com.pactera.madp.cp.api.model.workroom.WXWorkRoomModel;
import com.pactera.madp.cp.api.vo.taskpublish.GroupChatVO;
import com.pactera.madp.cp.api.vo.workroom.WorkRoomDataStatisticsVO;
import com.pactera.madp.cp.api.vo.workroom.WorkRoomPageVO;
import com.pactera.madp.cp.mapper.workroom.WorkRoomMapper;
import org.apache.ibatis.annotations.Param;

import java.text.ParseException;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author: yangpengwei
 * @time: 2021/3/17 3:58 下午
 * @description 客户群服务
 */
public interface IWorkRoomService extends IService<WorkRoomEntity> {

    Integer updateWorkRoomsByRoomGroupId(Integer workRoomGroupId, int i);

    /**
     * @author: yangpengwei
     * @time: 2021/3/17 3:59 下午
     * @description 获取客户群列表
     * @return
     */
    R getWorkRoomList(WorkRoomIndexDto workRoomIndexDto, ReqPerEnum permission, Page page);

    WorkRoomEntity getWorkRoom(Integer workRoomId);

    List<GroupChatVO> getWorkRoomName();

    List<GroupChatVO> getRoom();

    String getNameById(Integer id);

    /**
     * 根据 id获取群聊id
     * @param id
     * @return
     */
    String getUserId(Integer id);

    R handelWorkContactRoomData(WorkRoomEntity workRoomEntity, WorkContactRoomIndexDto workContactRoomIndexDto, Page page);

    List<WorkRoomEntity> getWorkRoomsByIds(String workContactRoomIds, String clStr);

    boolean syncWorkRoomIndex(Integer corpIds, List<WXWorkRoomModel> WXWorkRoomModelList, Integer isFlag) throws ParseException;

    List<WorkRoomEntity> getWorkRoomsByCorpId(Integer corpId, String s);

    List<WorkRoomEntity> getWorkRoomsByWxChatId(List<WXWorkRoomModel> wxWorkRoomModelList, String s);

    public Map<String, Object> handelWXWorkRoomModelData(List<WXWorkRoomModel> WXWorkRoomModelList, Integer corpId, int isSingle);

    R<Page> getWorkRoomSelectData(Integer corpId, String roomName, Integer roomGroupId, Integer current, Integer size);

    List<WorkRoomEntity> getWorkRoomsByChatId(List<String> wxRoomIdArr, String s);

    @Override
    WorkRoomMapper getBaseMapper();

    List<WorkRoomEntity> countWorkRoomByCorpIds(Integer corpId);

    List<WorkRoomEntity> countAddWorkRoomsByCorpIdTime(Integer corpId, Date startTime, Date endTime);

    List<WorkRoomEntity> selectAll(@Param("corpId") Integer corpId);

    R statistics(WorkRoomStatisticsIndexDto workRoomStatisticsIndexDto);

    R statisticsIndex(WorkRoomStatisticsIndexDto workRoomStatisticsIndex,Page page);

    WorkRoomDataStatisticsVO getStatisticsData();

    IPage<WorkRoomPageVO> getHoldRoomPage(Page page, String ownerName);

}
